package net.adetech.crj.dao;

import net.adetech.crj.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {

    @Insert("insert into CRJ_USER(ID_NUMBER,REAL_NAME,PHONE_NUMBER,CREATE_TIME,LAST_LOGIN_TIME,USER_TYPE) values (#{idNumber},#{realName},#{phoneNumber},sysdate,sysdate,#{userType,jdbcType=VARCHAR})")
    void insert(User user);

    @Select("select * from CRJ_USER where ID_NUMBER = #{idNumber}")
    User getUserByIdNUmber(String idNumber);

    @Update("update CRJ_USER set LAST_LOGIN_TIME = sysdate,USER_TYPE = #{userType,jdbcType=VARCHAR},PHONE_NUMBER = #{phoneNumber},REAL_NAME = #{realName} where ID_NUMBER = #{idNumber}")
    void update(User user);


}
